package com.fanbuchi.fukua.api;

import android.util.SparseArray;

import com.fanbuchi.fukua.entity.OauthEntity;
import com.fanbuchi.fukua.entity.UserEntity;
import com.fanbuchi.fukua.manager.OauthManager;
import com.fanbuchi.fukua.manager.UserManager;
import com.fanbuchi.fukua.validate.ProfileValidate;
import com.squareup.okhttp.Callback;
import com.squareup.okhttp.FormEncodingBuilder;
import com.squareup.okhttp.Request;
import com.squareup.okhttp.RequestBody;

/**
 * Created by Administrator on 2015/7/10.
 */
public class ProfileAPI extends API {
    private  final static String uri=getHost()+"/profile";
    private  final static String profile=uri+"/%s";//%s-->userName

    public static ProfileAPI API;

    private  ProfileAPI(){
    }
    public static ProfileAPI getAPI(){
        if (API==null){
            API = new ProfileAPI();
        }
        return API;
    }

    public SparseArray<String> profile(Callback callback) {
        OauthEntity oauthEntity= OauthManager.getOauthEntity();
      SparseArray<String> _result =  ProfileValidate.getProfileValidate(oauthEntity);
        if (_result.size()>0){
            return _result;
        }
        normalGetRequest(callback, String.format(profile, oauthEntity.getUserName()));
        return null;
    }
}
